package com.xingyun.service.grade.impl;

import com.xingyun.dao.grade.GradeMapper;
import com.xingyun.pojo.Grade;
import com.xingyun.service.grade.GradeService;
import com.xingyun.utils.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class GradeServiceImpl implements GradeService {

    /**
     * 查询所有年级
     *
     * @return
     */
    @Override
    public List<Grade> findAll() {
        SqlSession sqlSession = null;
        List<Grade> list = null;
        try {
            sqlSession = MyBatisUtils.createSqlSession();
            list = sqlSession.getMapper(GradeMapper.class).findAll();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            MyBatisUtils.createSqlSession();
        }
        return list;
    }
}
